Constrained first order optimization

#incomplete